export const download = (result: any, name = "文件", type = "application/octet-stream") => {
  const link = document.createElement("a")
  let blob = new Blob([result], { type })
  link.style.display = "none"
  link.download = name
  link.href = URL.createObjectURL(blob)
  document.body.appendChild(link)
  link.click()
  document.body.removeChild(link)
}

export const downloadPdf = (result: any, name = "文件") => {
  const link = document.createElement("a")
  let blob = new Blob([result], {
    type: "application/octet-stream",
    "Content-Disposition": "attachment"
  })
  link.style.display = "none"
  link.download = name
  link.href = URL.createObjectURL(blob)
  document.body.appendChild(link)
  link.click()
  document.body.removeChild(link)
}
